# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
import scipy as sp
from scipy import stats
if __name__ == '__main__':
    fig = plt.figure()
    fig.add_subplot(2,2,1)
    rand = np.random.rand(100)
    print rand
    plt.plot(rand)
    plt.show()
    print "----------------------高斯分布"
    x = np.linspace(-5, 15, 50)
    plt.plot(x, sp.stats.norm.pdf(x=x, loc=5, scale=2))
    # 生成直方图
    plt.hist(sp.stats.norm.rvs(loc=5, scale=2, size=200), bins=50, normed=True, color='red', alpha=0.5)
    plt.show()
    # 绘制散点图
    print "----------------------------"
    x = np.arange(50)
    print x
    y = x + 5* np.random.rand(50)
    print y
    plt.scatter(x, y)
    plt.show()

